<?php
namespace app\admin\validate;
use think\Validate;
class Users extends Validate
{
    // 验证规则
    protected $rule = [
        ['user_id', 'require'],
        ['type_id', 'require'],

    ];
    //错误信息
    protected $message  = [
        'user_id.require|unique'    => '用户必须|用户已经存在',
        'type_id.require'    => '类型必须',

    ];
    //验证场景
    protected $scene = [
        'add'  =>  [
            'user_id'    =>'require|unique:Users,user_id^user_id',
            'type_id'    =>'require|unique:Users,type_id^user_id',

        ],
    ];
}